﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutofacProject.Entity
{
    public class AutofacDbContext:DbContext
    {
        public AutofacDbContext()
          : base("test2")
        {
            Database.SetInitializer<AutofacDbContext>(null);
        }
        public DbSet<Student> Student { get; set; }
        public DbSet<Classes> Classes { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            // 禁用复数化
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}
